package pl.ydp.components.mathcell.mathrecognizer.engine.database.modelsets.math_basic.characters
{
	import pl.ydp.components.mathcell.mathrecognizer.characters.Character;
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveType;
	import pl.ydp.components.mathcell.mathrecognizer.model.PrimitivesRelation;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescription;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescriptorType;
	import pl.ydp.components.mathcell.mathrecognizer.model.ShapeModel;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.LocationDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ObjectDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.SizeDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.presets.PrimitivePresets;
	
	public class MB_ch_8
	{
		
		public static const MODELS_COUNT:Number = 2;
		
		//---------------------------------------------------
		
		public static function getModels():Array{
			
			var eightShapeModels:Array = new Array();
			
			eightShapeModels.push(getModel0());
			eightShapeModels.push(getModel1());	
			eightShapeModels.push(getModel2());			
			
			return eightShapeModels;
		}
		
		//---------------------------------------------------
		
		private static function getModel0():ShapeModel{
			var eight:ShapeModel;
			var name:String = "MB_8_QS-F";
			var eight_prim:Array = new Array();
			var eight_ref:Array = new Array();
			var eight_rel:Array = new Array();
			
			eight_prim.push(PrimitiveType.FLOURISH);
			
			eight_ref.push(0,PrimitivePresets.RLT_FULL);
			
			eight_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.HEIGHT | SizeDescriptor.ABOUT_15, 10)));
			
			eight_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.ABOUT_15, 10)));
			
			eight = new ShapeModel(Character.EIGHT, eight_prim, eight_ref, eight_rel, new Array(), name, false);
			
			return eight;				
		}
		
		//---------------------------------------------------
		
		private static function getModel1():ShapeModel{
			var eight:ShapeModel;
			var name:String = "MB_8_STD";
			var eight_prim:Array = new Array();
			var eight_ref:Array = new Array();
			var eight_rel:Array = new Array();
			
			eight_prim.push(PrimitiveType.LOOP, PrimitiveType.LOOP);
			
			eight_ref.push(0,1,PrimitivePresets.RLT_LEFT_HALF,PrimitivePresets.RLT_RIGHT_HALF);
			
			eight_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.MAX_BOTTOM, ObjectDescriptor.COG)));
			
			eight_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 3)));
			
			eight_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 3)));
			
			
			eight_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 3)));
			
			eight_rel.push(new RelationDescription(1,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 3)));
			
			
			eight = new ShapeModel(Character.EIGHT, eight_prim, eight_ref, eight_rel, new Array(), name, false);
			
			return eight;				
		}
		
		//---------------------------------------------------
		
		private static function getModel2():ShapeModel{
			var eight:ShapeModel;
			var name:String = "MB_8_APP";
			var eight_prim:Array = new Array();
			var eight_ref:Array = new Array();
			var eight_rel:Array = new Array();
			
			eight_prim.push(PrimitiveType.LOOP, PrimitiveType.CURVE_SE | PrimitiveType.CURVE_SW);
			
			eight_ref.push(0,1,PrimitivePresets.RLT_LEFT_HALF,PrimitivePresets.RLT_RIGHT_HALF);
			
			eight_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.MAX_BOTTOM, ObjectDescriptor.COG)));
			
			eight_rel.push(new RelationDescription(0,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 3)));
			
			eight_rel.push(new RelationDescription(0,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 3)));
			
			eight_rel.push(new RelationDescription(1,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.BEGIN, ObjectDescriptor.HALF_TOP)));
			
			eight_rel.push(new RelationDescription(1,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.END, ObjectDescriptor.HALF_TOP)));
			
			eight_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.RIGHT, 3)));
			
			eight_rel.push(new RelationDescription(1,3,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 3)));
			
			
			eight = new ShapeModel(Character.EIGHT, eight_prim, eight_ref, eight_rel, new Array(), name, false);
			
			return eight;				
		}
		
		//---------------------------------------------------
		
		
	}
}
